<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<!-- <text class="title">{{title}}</text> -->
			<navigator url="../zerjijeimian/zerjijeimian">跳转二级页面</navigator>
		</view>
	</view>
</template>

<script>
	var bitmap = null;
	export default {
		data() {
			return {
				title: '首页'
			}
		},
		onShow() { //显示突起图标
			var icon = plus.nativeObj.View.getViewById("icon");  //根据图标id取到图片
			if (icon) {
				setTimeout(function(){
					icon.show();
				},50)
			}
		},
		onLoad() { //加载图片
			//兼容ios端
			bitmap = new plus.nativeObj.Bitmap('bmp1');  //新增原生图片
			//bitmap.load('static/tab_icon_5.png', function() {}, function(e) {});  普通写法
			bitmap.loadBase64Data('', function() {}, function(e) {});
			this.createtab();
		},
		methods: {
			createtab: function(){
				// 设置水平居中位置
				var leftPos = Math.ceil((plus.screen.resolutionWidth - 50) / 2);
				var view = new plus.nativeObj.View('icon', {
					bottom: '19px',
					left: leftPos + 'px',
					width: '50px',
					height: '50px'
				});
				//使用canvas画布把图标画到tabbar对应位置上
				view.drawBitmap(bitmap, {
					tag: 'font',
					id: 'icon',
					src: '/static/circle.png',
					position: {
						top: '0px',
						left: '5px',
						width: '50px',
						height: '100%'
					}
				});
				//监听界面跳转
				view.addEventListener("click", function(e) {
					uni.switchTab({
						url: '/pages/circle/circle'
					})
				}, false);
				view.show();
			}
		}
		
	}
</script>
<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
